﻿
using Hyjx.GF.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

string connectionString = "Filename=D:\\Temp\\GanFengDB.db3;Password=123456";

IHostBuilder hostBuilder = Host.CreateDefaultBuilder(args)
    .ConfigureServices((hostContext, services) =>
    {
        services.AddDbContext<GFDbContext>((option) =>
        {
            option.UseSqlite(connectionString);
        });
    });
// 建造 Host
IHost host = hostBuilder.Build();

//var db = host.Services.GetRequiredService<GFDbContext>();
//for (int i = 0; i < 202; i++)
//{
//    db.PowderReports.Add(new()
//    {
//        ActualValue = i,
//        CreatedTime = DateTime.Now,
//        DeviceName = $"{i}# 搅拌机",
//        EndTime = DateTime.Now.AddMinutes(i + 1),
//        MaterialCode = 101 + i,
//        SettingValue = i,
//        StartTime = DateTime.Now
//    });
//}
//db.SaveChanges();
//Console.WriteLine("已插入数据完成");
//Console.ReadLine();